Understanding Computer Programming

Osher Lifelong Learning Institute
University of Illinois, Urbana-Champaign

Scott Badman, Instructor


Topic: User Friendliness, adding prompts to the program

February 4, 2016


PRINT "Please enter a number to see if it is a prime:"
INPUT number

prime$ = "True"

divisor = 2

WHILE divisor < number

    intermediate = number

    WHILE intermediate >= divisor
        intermediate = intermediate - divisor
    WEND

    remainder = intermediate

    IF remainder = 0 THEN
        prime$ = "False"
    END IF

    divisor = divisor + 1

WEND

IF print$ = "True" THEN
    PRINT number; " is a prime."
ELSE
    PRINT number; " is not a prime."
END IF


Understanding Computer Programming

Osher Lifelong Learning Institute
University of Illinois, Urbana-Champaign

Scott Badman, Instructor